﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// abstract OSAGPromjena typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class OSAGPromjenaDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<OSAGPromjenaDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.OSAGPromjena _currentOSAGPromjena = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxOSAGPromjenaDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxOSAGPromjenaErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxOSAGPromjenaBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the ID property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDOS property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDOSDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDOSGrupa property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDOSGrupaDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDKontoNabave property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDKontoNabaveDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDKontoIspravka property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDKontoIspravkaDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDKontoTroska property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDKontoTroskaDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDOSAG property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDOSAGDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DatumOd property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDatumOdDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DatumDo property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDatumDoDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.Konto> _IDKontoIspravkaList;
		
		/// <summary> 
		/// The list of selectable Konto
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Konto> IDKontoIspravkaList
		{
			get {return this._IDKontoIspravkaList;}
			set 
			{
				this._IDKontoIspravkaList = value;
				this.uxIDKontoIspravkaDataGridViewColumn.DataSource = null;
				this.uxIDKontoIspravkaDataGridViewColumn.DataSource = this._IDKontoIspravkaList;
			}
		}
		
		private bool _allowNewItemInIDKontoIspravkaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Konto
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDKontoIspravkaList
		{
			get { return _allowNewItemInIDKontoIspravkaList;}
			set
			{
				this._allowNewItemInIDKontoIspravkaList = value;
				this.uxIDKontoIspravkaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Konto> _IDKontoTroskaList;
		
		/// <summary> 
		/// The list of selectable Konto
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Konto> IDKontoTroskaList
		{
			get {return this._IDKontoTroskaList;}
			set 
			{
				this._IDKontoTroskaList = value;
				this.uxIDKontoTroskaDataGridViewColumn.DataSource = null;
				this.uxIDKontoTroskaDataGridViewColumn.DataSource = this._IDKontoTroskaList;
			}
		}
		
		private bool _allowNewItemInIDKontoTroskaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Konto
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDKontoTroskaList
		{
			get { return _allowNewItemInIDKontoTroskaList;}
			set
			{
				this._allowNewItemInIDKontoTroskaList = value;
				this.uxIDKontoTroskaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Konto> _IDKontoNabaveList;
		
		/// <summary> 
		/// The list of selectable Konto
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Konto> IDKontoNabaveList
		{
			get {return this._IDKontoNabaveList;}
			set 
			{
				this._IDKontoNabaveList = value;
				this.uxIDKontoNabaveDataGridViewColumn.DataSource = null;
				this.uxIDKontoNabaveDataGridViewColumn.DataSource = this._IDKontoNabaveList;
			}
		}
		
		private bool _allowNewItemInIDKontoNabaveList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Konto
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDKontoNabaveList
		{
			get { return _allowNewItemInIDKontoNabaveList;}
			set
			{
				this._allowNewItemInIDKontoNabaveList = value;
				this.uxIDKontoNabaveDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.OSAmortizacijskaGrupa> _IDOSAGList;
		
		/// <summary> 
		/// The list of selectable OSAmortizacijskaGrupa
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.OSAmortizacijskaGrupa> IDOSAGList
		{
			get {return this._IDOSAGList;}
			set 
			{
				this._IDOSAGList = value;
				this.uxIDOSAGDataGridViewColumn.DataSource = null;
				this.uxIDOSAGDataGridViewColumn.DataSource = this._IDOSAGList;
			}
		}
		
		private bool _allowNewItemInIDOSAGList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of OSAmortizacijskaGrupa
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDOSAGList
		{
			get { return _allowNewItemInIDOSAGList;}
			set
			{
				this._allowNewItemInIDOSAGList = value;
				this.uxIDOSAGDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.OSGrupa> _IDOSGrupaList;
		
		/// <summary> 
		/// The list of selectable OSGrupa
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.OSGrupa> IDOSGrupaList
		{
			get {return this._IDOSGrupaList;}
			set 
			{
				this._IDOSGrupaList = value;
				this.uxIDOSGrupaDataGridViewColumn.DataSource = null;
				this.uxIDOSGrupaDataGridViewColumn.DataSource = this._IDOSGrupaList;
			}
		}
		
		private bool _allowNewItemInIDOSGrupaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of OSGrupa
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDOSGrupaList
		{
			get { return _allowNewItemInIDOSGrupaList;}
			set
			{
				this._allowNewItemInIDOSGrupaList = value;
				this.uxIDOSGrupaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.OsnovnoSredstvo> _IDOSList;
		
		/// <summary> 
		/// The list of selectable OsnovnoSredstvo
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.OsnovnoSredstvo> IDOSList
		{
			get {return this._IDOSList;}
			set 
			{
				this._IDOSList = value;
				this.uxIDOSDataGridViewColumn.DataSource = null;
				this.uxIDOSDataGridViewColumn.DataSource = this._IDOSList;
			}
		}
		
		private bool _allowNewItemInIDOSList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of OsnovnoSredstvo
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDOSList
		{
			get { return _allowNewItemInIDOSList;}
			set
			{
				this._allowNewItemInIDOSList = value;
				this.uxIDOSDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.OSAGPromjena> _OSAGPromjenaList;
				
		/// <summary> 
		/// The list of OSAGPromjena to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.OSAGPromjena> OSAGPromjenaList
		{
			get {return this._OSAGPromjenaList;}
			set
			{
				this._OSAGPromjenaList = value;
				this.uxOSAGPromjenaBindingSource.DataSource = null;
				this.uxOSAGPromjenaBindingSource.DataSource = value;
				this.uxOSAGPromjenaDataGridView.DataSource = null;
				this.uxOSAGPromjenaDataGridView.DataSource = this.uxOSAGPromjenaBindingSource;				
				//this.uxOSAGPromjenaBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxOSAGPromjenaBindingSource_ListChanged);
				this.uxOSAGPromjenaBindingSource.CurrentItemChanged += new System.EventHandler(OnOSAGPromjenaBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnOSAGPromjenaBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentOSAGPromjena = uxOSAGPromjenaBindingSource.Current as Entities.OSAGPromjena;
			
			if (_currentOSAGPromjena != null)
			{
				_currentOSAGPromjena.Validate();
			}
			//_OSAGPromjena.Validate();
			OnCurrentEntityChanged();
		}

		//void uxOSAGPromjenaBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.OSAGPromjena"/> instance.
		/// </summary>
		public Entities.OSAGPromjena SelectedOSAGPromjena
		{
			get {return this._currentOSAGPromjena;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxOSAGPromjenaDataGridView.VirtualMode;}
			set
			{
				this.uxOSAGPromjenaDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxOSAGPromjenaDataGridView.AllowUserToAddRows;}
			set {this.uxOSAGPromjenaDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxOSAGPromjenaDataGridView.AllowUserToDeleteRows;}
			set {this.uxOSAGPromjenaDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxOSAGPromjenaDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxOSAGPromjenaDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="OSAGPromjenaDataGridViewBase"/> class.
		/// </summary>
		public OSAGPromjenaDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxOSAGPromjenaDataGridView = new System.Windows.Forms.DataGridView();
			this.uxOSAGPromjenaBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxOSAGPromjenaErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDOSDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDOSGrupaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDKontoNabaveDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDKontoIspravkaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDKontoTroskaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDOSAGDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxDatumOdDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxDatumDoDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			//this.uxIDKontoIspravkaBindingSource = new KontoBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKontoIspravkaBindingSource)).BeginInit();
			//this.uxIDKontoTroskaBindingSource = new KontoBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKontoTroskaBindingSource)).BeginInit();
			//this.uxIDKontoNabaveBindingSource = new KontoBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKontoNabaveBindingSource)).BeginInit();
			//this.uxIDOSAGBindingSource = new OSAmortizacijskaGrupaBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDOSAGBindingSource)).BeginInit();
			//this.uxIDOSGrupaBindingSource = new OSGrupaBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDOSGrupaBindingSource)).BeginInit();
			//this.uxIDOSBindingSource = new OsnovnoSredstvoBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDOSBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSAGPromjenaDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSAGPromjenaBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSAGPromjenaErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxOSAGPromjenaErrorProvider
			// 
			this.uxOSAGPromjenaErrorProvider.ContainerControl = this;
			this.uxOSAGPromjenaErrorProvider.DataSource = this.uxOSAGPromjenaBindingSource;						
			// 
			// uxOSAGPromjenaDataGridView
			// 
			this.uxOSAGPromjenaDataGridView.AutoGenerateColumns = false;
			this.uxOSAGPromjenaDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxOSAGPromjenaDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDDataGridViewColumn,
		this.uxIDOSDataGridViewColumn,
		this.uxIDOSGrupaDataGridViewColumn,
		this.uxIDKontoNabaveDataGridViewColumn,
		this.uxIDKontoIspravkaDataGridViewColumn,
		this.uxIDKontoTroskaDataGridViewColumn,
		this.uxIDOSAGDataGridViewColumn,
		this.uxDatumOdDataGridViewColumn,
		this.uxDatumDoDataGridViewColumn			});
			this.uxOSAGPromjenaDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxOSAGPromjenaDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxOSAGPromjenaDataGridView.Name = "uxOSAGPromjenaDataGridView";
			this.uxOSAGPromjenaDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxOSAGPromjenaDataGridView.TabIndex = 0;	
			this.uxOSAGPromjenaDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxOSAGPromjenaDataGridView.EnableHeadersVisualStyles = false;
			this.uxOSAGPromjenaDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnOSAGPromjenaDataGridViewDataError);
			this.uxOSAGPromjenaDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnOSAGPromjenaDataGridViewCellValueNeeded);
			this.uxOSAGPromjenaDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnOSAGPromjenaDataGridViewCellValuePushed);
			
			//
			// uxIDDataGridViewColumn
			//
			this.uxIDDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDataGridViewColumn.DataPropertyName = "ID";
			this.uxIDDataGridViewColumn.HeaderText = "ID";
			this.uxIDDataGridViewColumn.Name = "uxIDDataGridViewColumn";
			this.uxIDDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDataGridViewColumn.ReadOnly = true;		
			//
			// uxIDOSDataGridViewColumn
			//
			this.uxIDOSDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDOSDataGridViewColumn.DataPropertyName = "IDOS";
			this.uxIDOSDataGridViewColumn.HeaderText = "IDOS";
			this.uxIDOSDataGridViewColumn.Name = "uxIDOSDataGridViewColumn";
			this.uxIDOSDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDOSDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDOSDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDOSGrupaDataGridViewColumn
			//
			this.uxIDOSGrupaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDOSGrupaDataGridViewColumn.DataPropertyName = "IDOSGrupa";
			this.uxIDOSGrupaDataGridViewColumn.HeaderText = "IDOSGrupa";
			this.uxIDOSGrupaDataGridViewColumn.Name = "uxIDOSGrupaDataGridViewColumn";
			this.uxIDOSGrupaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDOSGrupaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDOSGrupaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDKontoNabaveDataGridViewColumn
			//
			this.uxIDKontoNabaveDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDKontoNabaveDataGridViewColumn.DataPropertyName = "IDKontoNabave";
			this.uxIDKontoNabaveDataGridViewColumn.HeaderText = "IDKontoNabave";
			this.uxIDKontoNabaveDataGridViewColumn.Name = "uxIDKontoNabaveDataGridViewColumn";
			this.uxIDKontoNabaveDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDKontoNabaveDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDKontoNabaveDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDKontoIspravkaDataGridViewColumn
			//
			this.uxIDKontoIspravkaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDKontoIspravkaDataGridViewColumn.DataPropertyName = "IDKontoIspravka";
			this.uxIDKontoIspravkaDataGridViewColumn.HeaderText = "IDKontoIspravka";
			this.uxIDKontoIspravkaDataGridViewColumn.Name = "uxIDKontoIspravkaDataGridViewColumn";
			this.uxIDKontoIspravkaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDKontoIspravkaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDKontoIspravkaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDKontoTroskaDataGridViewColumn
			//
			this.uxIDKontoTroskaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDKontoTroskaDataGridViewColumn.DataPropertyName = "IDKontoTroska";
			this.uxIDKontoTroskaDataGridViewColumn.HeaderText = "IDKontoTroska";
			this.uxIDKontoTroskaDataGridViewColumn.Name = "uxIDKontoTroskaDataGridViewColumn";
			this.uxIDKontoTroskaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDKontoTroskaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDKontoTroskaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDOSAGDataGridViewColumn
			//
			this.uxIDOSAGDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDOSAGDataGridViewColumn.DataPropertyName = "IDOSAG";
			this.uxIDOSAGDataGridViewColumn.HeaderText = "IDOSAG";
			this.uxIDOSAGDataGridViewColumn.Name = "uxIDOSAGDataGridViewColumn";
			this.uxIDOSAGDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDOSAGDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDOSAGDataGridViewColumn.ReadOnly = false;		
			//
			// uxDatumOdDataGridViewColumn
			//
			this.uxDatumOdDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDatumOdDataGridViewColumn.DataPropertyName = "DatumOd";
			this.uxDatumOdDataGridViewColumn.HeaderText = "DatumOd";
			this.uxDatumOdDataGridViewColumn.Name = "uxDatumOdDataGridViewColumn";
			this.uxDatumOdDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDatumOdDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDatumOdDataGridViewColumn.ReadOnly = false;		
			//
			// uxDatumDoDataGridViewColumn
			//
			this.uxDatumDoDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDatumDoDataGridViewColumn.DataPropertyName = "DatumDo";
			this.uxDatumDoDataGridViewColumn.HeaderText = "DatumDo";
			this.uxDatumDoDataGridViewColumn.Name = "uxDatumDoDataGridViewColumn";
			this.uxDatumDoDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDatumDoDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDatumDoDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDKontoIspravkaDataGridViewColumn
			//				
			this.uxIDKontoIspravkaDataGridViewColumn.DisplayMember = "Sifra";	
			this.uxIDKontoIspravkaDataGridViewColumn.ValueMember = "ID";	
			this.uxIDKontoIspravkaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDKontoIspravkaDataGridViewColumn.DataSource = uxIDKontoIspravkaBindingSource;				
				
			//
			// uxIDKontoTroskaDataGridViewColumn
			//				
			this.uxIDKontoTroskaDataGridViewColumn.DisplayMember = "Sifra";	
			this.uxIDKontoTroskaDataGridViewColumn.ValueMember = "ID";	
			this.uxIDKontoTroskaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDKontoTroskaDataGridViewColumn.DataSource = uxIDKontoTroskaBindingSource;				
				
			//
			// uxIDKontoNabaveDataGridViewColumn
			//				
			this.uxIDKontoNabaveDataGridViewColumn.DisplayMember = "Sifra";	
			this.uxIDKontoNabaveDataGridViewColumn.ValueMember = "ID";	
			this.uxIDKontoNabaveDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDKontoNabaveDataGridViewColumn.DataSource = uxIDKontoNabaveBindingSource;				
				
			//
			// uxIDOSAGDataGridViewColumn
			//				
			this.uxIDOSAGDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDOSAGDataGridViewColumn.ValueMember = "ID";	
			this.uxIDOSAGDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDOSAGDataGridViewColumn.DataSource = uxIDOSAGBindingSource;				
				
			//
			// uxIDOSGrupaDataGridViewColumn
			//				
			this.uxIDOSGrupaDataGridViewColumn.DisplayMember = "Oznaka";	
			this.uxIDOSGrupaDataGridViewColumn.ValueMember = "ID";	
			this.uxIDOSGrupaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDOSGrupaDataGridViewColumn.DataSource = uxIDOSGrupaBindingSource;				
				
			//
			// uxIDOSDataGridViewColumn
			//				
			this.uxIDOSDataGridViewColumn.DisplayMember = "IDParentOS";	
			this.uxIDOSDataGridViewColumn.ValueMember = "ID";	
			this.uxIDOSDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDOSDataGridViewColumn.DataSource = uxIDOSBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxOSAGPromjenaDataGridView);
			this.Name = "OSAGPromjenaDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKontoIspravkaBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKontoTroskaBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKontoNabaveBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDOSAGBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDOSGrupaBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDOSBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSAGPromjenaErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSAGPromjenaDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOSAGPromjenaBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				OSAGPromjenaDataGridViewEventArgs args = new OSAGPromjenaDataGridViewEventArgs();
				args.OSAGPromjena = _currentOSAGPromjena;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class OSAGPromjenaDataGridViewEventArgs : System.EventArgs
		{
			private Entities.OSAGPromjena	_OSAGPromjena;
	
			/// <summary>
			/// the  Entities.OSAGPromjena instance.
			/// </summary>
			public Entities.OSAGPromjena OSAGPromjena
			{
				get { return _OSAGPromjena; }
				set { _OSAGPromjena = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxOSAGPromjenaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnOSAGPromjenaDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxOSAGPromjenaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnOSAGPromjenaDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxOSAGPromjenaDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						e.Value = OSAGPromjenaList[e.RowIndex].ID;
						break;
					case "uxIDOSDataGridViewColumn":
						e.Value = OSAGPromjenaList[e.RowIndex].IDOS;
						break;
					case "uxIDOSGrupaDataGridViewColumn":
						e.Value = OSAGPromjenaList[e.RowIndex].IDOSGrupa;
						break;
					case "uxIDKontoNabaveDataGridViewColumn":
						e.Value = OSAGPromjenaList[e.RowIndex].IDKontoNabave;
						break;
					case "uxIDKontoIspravkaDataGridViewColumn":
						e.Value = OSAGPromjenaList[e.RowIndex].IDKontoIspravka;
						break;
					case "uxIDKontoTroskaDataGridViewColumn":
						e.Value = OSAGPromjenaList[e.RowIndex].IDKontoTroska;
						break;
					case "uxIDOSAGDataGridViewColumn":
						e.Value = OSAGPromjenaList[e.RowIndex].IDOSAG;
						break;
					case "uxDatumOdDataGridViewColumn":
						e.Value = OSAGPromjenaList[e.RowIndex].DatumOd;
						break;
					case "uxDatumDoDataGridViewColumn":
						e.Value = OSAGPromjenaList[e.RowIndex].DatumDo;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxOSAGPromjenaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnOSAGPromjenaDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxOSAGPromjenaDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						OSAGPromjenaList[e.RowIndex].ID = (System.Int32)e.Value;
						break;
					case "uxIDOSDataGridViewColumn":
						OSAGPromjenaList[e.RowIndex].IDOS = (System.Int32)e.Value;
						break;
					case "uxIDOSGrupaDataGridViewColumn":
						OSAGPromjenaList[e.RowIndex].IDOSGrupa = (System.Int32)e.Value;
						break;
					case "uxIDKontoNabaveDataGridViewColumn":
						OSAGPromjenaList[e.RowIndex].IDKontoNabave = (System.Int32)e.Value;
						break;
					case "uxIDKontoIspravkaDataGridViewColumn":
						OSAGPromjenaList[e.RowIndex].IDKontoIspravka = (System.Int32)e.Value;
						break;
					case "uxIDKontoTroskaDataGridViewColumn":
						OSAGPromjenaList[e.RowIndex].IDKontoTroska = (System.Int32)e.Value;
						break;
					case "uxIDOSAGDataGridViewColumn":
						OSAGPromjenaList[e.RowIndex].IDOSAG = (System.Int32)e.Value;
						break;
					case "uxDatumOdDataGridViewColumn":
						OSAGPromjenaList[e.RowIndex].DatumOd = (System.DateTime)e.Value;
						break;
					case "uxDatumDoDataGridViewColumn":
						OSAGPromjenaList[e.RowIndex].DatumDo = (System.DateTime?)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
